package PTA2.ti901;

import java.util.Scanner;

/**
 * @author Lenovo
 */
public class Main {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        StringBuilder result=new StringBuilder();
        while (scanner.hasNext()){
            String input=scanner.next();
            if("end".equals(input)){
                break;
            }
            if(input.length()%3==0){
                result.append(input).append(" ");
            }
        }
        System.out.println(result.toString());
        scanner.close();
    }
}
